package cn.edu.nwpu.warehousemanagement.pojo;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Table;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "product")
public class Product extends BaseEntity {
    @Column(name = "name", nullable = false, length = 100)
    @NotNull
    private String name;

    @Column(columnDefinition = "TEXT")
    private String description;

    @Column(name = "unit", length = 20)
    private String unit;

    @Schema(description = "库存数量")
    @Column(name = "quantity", nullable = false)
    private Long quantity;

    public Product(long id) {
        this.setId(id);
    }
}